Refactoring and added QASC functionality