refactored methods out to a utils class
fixed keysize finding code to work