modified code to OOJS standards