Fixed if; base API; added env to config