Refactored code.
split_at implemented.