Change type check to integer.
Clean up code.