Start to write more logic functions