Rewritten with Split, far more efficient. Updated validity checks
Added divide method.