prevent creation of same fields with diff types
corrected error checking
cleanup & fmt