Made code more clean, and less complex