removed commented debug function, renamed variables