code looks horrible but still