Changed the order of functions so that it matches the original spec doc