Moving some functions around, taking stroke direction into account