initial version without pascal changes