Added most functions and test page