Implement orientation funciton