Clean up  code and allow methods other than GET