make the code more readable
edit to match my lou tweak changes