Improved placement of parts (i.e., Cell.isValid(..). Avoid corners of grid.

please review @linzhp