Refactor if statements and bugfixing.