added algorithm for heap support
added model struct