Fixed major efficiency bug