slightly shortened module code and complemented test suite