Refactored
Added template