Made some behaviour and bug fixes.