Added optional name field and some tweaks and fixes