Fix struct order
Slight refactoring and addition of utils
Fix case