add some sanity checks, reformatting, better numpy integration