Code cleanup and remove unused files