refactored bitmap wrapper
added indexer
moved depth check outside of try block