Need to write tests for this crap