moved inference only code to separate file