refactored linear partition