Style fixes and small code cleanups.

Also removed some code and variables that wasn't used, please check this code.