Made improvements

Added input code checking