addressing some of the static analysis issues identified by ideaj