Fixed parameter passing and added a test