My take on stanford' CS106B winter 2014 session, homework 1