fixed language level errors
simplified internal logic, equals bug