Fixing pointer issues (I hope)