Organized code and removed dead code