Refactored most of the code, fixed some bugs, and removed Swift