Added memory allocation
Deleted useless methods