code updates and reorganisation