refactored to give more sensible input arguments in model