Added unit testing
some more explicit coding of inputs and outputs