Cleaned and Commented

Cleaned up unused legacy functions and commented code