Cosmestic fixes, comments and code formatting