moved sql modifications to separate method