removed unused code
simplified code