Tests updated, code was optimized for tests