removed debugging code and made stylistic cleanups