Refactored URL for request and moved submit to another function