Some code cleanup and commented some errornous code