Added test for the update, and clear more code