introduce warnings and potential problems detection + code refactor