INT_MAX signals error here. returning 0 forces the system into an endless loop