Cleaned up code and docstrs. Split complicated lines into simpler lines