renamed functions
fixed templates