Seriously shortened the API by using reused functions + fixed #33: http status codes are now correct, and integrated into these functions