freeing malloced memory, added screenshots