Uncommented test code, and put in actual JS calls..Needs to be tested