added custom library and fixed retrieval from database