Updated with struct/impl

Generally cleaned up the code... No longer manually piping between the file descriptors.