Add Exceptions & more tests

Added an exception that throws if the substring would break
Added a lot of tests to cover most of the code