Moved functions to separate package and added CLI.