Incorporated more variables, and actually saved this time!

Tried to eliminate as many "magic numbers" as possible