Implemented linear helper function