After doing some refactoring of select functions to remove duplicate code

Signed-off-by: unknown <cnwnh1@cnwcb5a.cnw.co.nz>