Tested code

Tested code, fixed error