Rearranged code to allow for multiple executables