james simplified my code a little here