Initial commit. Cleaned up code a bit from another project.