cleaning up the code a bit. More reader-friendly