Fixed ThisRef error in the final submission
Almost working version with some known bugs (null type)