add --optimize, removes debug type checks, adds type casts