Fix dbAttributes handling
Improve if/else organization