front-end changes

moving back-end code to front-end, in order to get display running as desired.