refactored to remove arguments, used use strict, renamed variables and some code cleanup