Implemented line graph and fixed several bugs