Made variables public and simplified if statements