added register command, refactor and schema fix