Refactored predict to make it concise