added spacing, separated logic