Major bugs fixed (though still not working as it should).