Cleaned up some code. Added validation to prefix.