Minor fixes and started with cleaning the code.