added comments throughout and further styled