use a function instead of re-writing it