added code and test