Refactored THANKS KIKO
changed for refactoring