Changed some function definitions and added some more tests