Refactor: Add factories and tests