Add error checks, support custom build command