Add arch support

Adds arch support, fixes a couple of bugs and changes some completely unrelated things