Refactor code

-reduced number of functions supporting command functions
-update documentation