Seek ahead instead of using padding variables
Also moved things out to their own files and setup require()s to bring it all together.