Added support for [type=number]. Minor bug fixes.