fixed tests, style and cleanup