added coverage-tests and improve reliability of implementation