shifted everything into a file structure and fixed bugs