Modifications to automatics

- A lot of redundant and spaghetti code added, but it's the only way I managed
to get it working within a reasonable timeframe
- Should fix #1214