Added switch
Removed unneeded functions
Exported
Added docstrings