Commented mostly everything, removed a bug