version 0.3, support optional parallel computation using parallel.js, code refactoring