first iteration on refactoring

CC: egor, esayle, abahouth, mhalverson, SQLWILL, kali

Differential Revision: http://phabulous.newokl.com/D31
checkpointing