fixed unexpected spin resets + code clean up