updated wrapper function
updated inverse model function