made changes with some unfortunate bugs