finished refactor no sql in main app