dressed up code a little bit for readability