collections and exceptions optimalization