Changed function arguments, now functions take objects as input