Added comments, organized the code a bit