i really need to write tests for this