Previous Commit with more bug fixes