Remove whitespace, optimize imports and use foreach