Clean up code and fixed update frequency