Cleaned up a lot of code and finally got the `exec` command working as intended