introduce async command handler
reorganise core lib