more refactoring of createApplicationAt() function. cleaning up constants.