Updated to mostly work.