Made console thread-safe