removing dead code and some cleanup