third commit. Bugs fixed.