added clear function, resolves #1