Added new functions and cleaned up code

* Added 'flatten' functionality
* Fixed 'interlace' functionality