Revised!

Revised code for simplicity