Code cleanup and formattings