JBean's submission for R assignment 2 - Version 3