Totally working. Needs code cleanup.