removed unused code and some formatting