removed two instances of strcmp, use type and value compare
remove second instance of array_keys, move to top, rework comments
errors to 0