adding a few basic functions
adding more code but it already needs refactoring (see repo.r)