Modified case execution function, should work with new file format now, need to test