implemented everything needed for a nice check_plugin and some tests