changed a few things and managed to debug some things in repl