Complete restructure of code. Backup of old code added.

Signed-off-by: Jake Reher <jake.reher@gmail.com>