Simplified some things as suggested by Intellij