Added one more emitting method for position x, y.
Refactored code to remove duplicates