Added docstrings and minor refactoring
Added a test for bad prefixes and further refactoring