adding move function and various fixes