Move things to configs and clean up code