controller mechanism added, with bug fixes