code splited to reflect MVC style

because grannularity matter ;)