Restructuring display.c

This should remove most, if not all warnings concerning display.c. Added
some light documentation as well.