modified cubex.java