Enabled compiler option -Xlint:unchecked to check variable types and fixed all warnings