Documentation added plus some logic changes(not finished)