reorganized dir struct. added funcs