adding functionality to allocate, mark, sweep plus added Element class