refactored #to_h
add #constract test