moved gesture direction detection functions into separate file