Removed some redundant code. Added in api_route variable.