Clean up code and remove unused files