Mostly finished code. All it needs is a few adjustments and docs