changed ordering of functions