Lib logic