Moved common stuff to abstract method and removed commented code