Added templates. Externalized all consts