Routes and Env detection

This is quite the learning process! If anyone has any tips or ways that
a beginner can refactor please let me know!