#4: Code cleanup in preparation for async implementation