solving retation errors and basic template implementation