forgot to add comments, also cleaned up my code