added display and clear functions.
Fixed many bugs.