Fix and optimize code
Merge pull request #28 from YoussefKababe/master

Fix and optimize code