Changed model to work with new function