Raise an exception if package is neither a string nor a BasePackage
missing comments
Cleanup
Better organization
Added docstrings