Added Towny support and refactored code