Did a code clearup and added config options