Added basic to_struct method.
Improved to_struct method.