Refactor during study hours to clean up bugs