refactored TTC2013 code

up to task #3