Issue4 issue5 general improvements

Ready for big fixes and the integration with a web frontend.