Small fixes and testing framework