Refactoring + integration test, make first field PK (WIP)