[WIP] implementing main routine