cleaned up the code a bit while looking through it