Add additional test and DRY up code