Started to port the Java code to ruby