use constant, no magic number
throw error objects
reduce casts