Programmatic use + small changes

fixes #4