removed unused functions
code cleanup
docstring cleanup
cleaned up some boundary issues