created 2 functions that returns x offset and y offset