fixed a minor bug and added some code to test what function will be called depending on input