Cleaned up types, added missing documentation