some optimization / cleanup