various bugfixes, small rearchitecture to remove app files from the main directory