Tests and debugging

Added some functionality for testing and debugging purposes.