cleans up logic