fixes, location embedding and some cleanup