Small refactor, fixed fatal error