code refactored for spaces.