Relocated function
Added header comments, cleaned up makefile