The structure of finite algebras