added logging
also removed unneeded lines