Code cleanup. Added function header and file header