Added support for types

Also fixed issue where 0 was being treated as undefined