added binary IO, cleaned up code, removed unefficient parallelization