Lots and lots of changes.
Convert boolean to number.