New code layout, new filenames

Changed code strategy from class, to global functions. Doesn't work!