Simplifying the code

Simplifying the code and giving more semantics to it