Added implementation code to functions.