Modified to allow moving K to spaces.