Updated and tested code