Cleaned and organized code