Changed frame loading and event listening to use conditionals