Added helper function and fixed method calls so that IDE wouldn't complain