consider to encapsulate logic within these conditionals in extra functions