This all looks good. two things:

1. You don't need to use "then" in ruby in an if statement
2. I think you _might_ have a bug here where you divide by 2. I wasn't sure how "2" became a magic number here