switch to apache Base64
small all around code cleanup