revised normalize functions and bug fixing, mapped var names and type conversion