refactor to use core http and fix bug with input passed to core in functions