tweaked lib for my use