refactored #to_h