refactored data flow. added status codes (406 if theres a problem, 200 otherwise). did a bit of testing