Refactor handdler to not use a class