Adding functional code

#1