Some refactoring and playing
Starting playing with using the API