Last commit of the day with working implementation of the main logic.