Implemented nearestSideEdge

Added nearestSideEdge function that gets the position on the nearest
side edge. Also fixed tabs.