This is a solution for ProgrammingAssignment2. The author is Marko Mitic (myself)