Code cleanup and organized