Better update routine and small code changes