Import code from original project

The bulk of the code written in my first attempt at this project.