used partials instead of copy-and-paste code