Some rules to improve performance of some pair related operations.
Added 'take' and 'takeEnd' functions.