V1

Correcting some bugs and some code was optimized
V1

.