heaps module refactored out plus readme and license