Refactoring, added view_dir db script