Implemented SQL installation routine and refactoring