refactored
refactored and fixed x/y - Bug