refactor config
PDO conversion
refactored index/template