java code removed, common code simplified