Cleanup some code
Add some test

Just because