some more improvements to lamp code