Utils tests

Let me know if anything needs changing or if I need to add anymore test cases before I rebase the commits.