This class could be better refactored to get better performance