moved post functions to controller file