Clearer functions. Removed some logging.