Refactorred code a bit
Refactorred code to be more easy to read

The code is now working properly :)