we should have unit tests for this