added more type annotations for readibility