Improved overall configurability and did some refactoring