bug fixes and more whitespace removal