added clear method
implement predict() and general code cleanup