fully implemented dynamic behaviour - clean under valgrind
finished implementing error codes for insufficient memory