added NDEBUG before assert, fixed indenting, formatting