Refactored
Bug with 5 variables