Finished, organized code