Fixing refactory errors