Improve the code throughout.