rewrite without the magic numbers