some rudimentary error handling in the go function