#216 Updated and Tested code