some tweaks + error handling