Updated code

created a package so that it can be used with other projects. still a
little buggy though.