Added basicHandler into webface.
Reorganized some functions to simplify readability.