Added some function code