Context struct init and clear