Function can now split up at any row