added update function, fixed formatting issues