basic function implementation
added a way to build and use this program when X11 libraries are absent.