this should have unit tests