Re-formatted code and removed some warnings
Some more changes