UPD: changed the ranges on numeric values and fixed a minor bug