adding all the actual code and one test. needs moar tests