CODE IS STREAMLINED, CLEAR WITH VALGRIND.