Add tests and code for dispense method