put templates into resource folder
refactor checks into separate class