Clean the code and add tweaks