Rewriting from ground up. Bad code.