beginning to write logic functions