Cleaning up logic