Removing unused refs and some quick fixes.