refactored predict method to be more accurate and reduce latency