pattern matching in execute() changed with if-else
fixed type matching