Changes to make it take arguments, so API can call it