Add AbstractSpaceBeforeRule and move common logic into it