split position algorithm to a single class