Threw in some code from another project

now contains stuff good for production