code cleanup, fixed type checking, fixed code formatting
fixed white space (4 tabs instead of tab, no trailing white space)