Template method pattern

Pull request for issue #13