App config

Fix for #256 

This should work, please test and merge if you're happy with it.