refactored main mite.js, code has errors from moving parsing code to another file.