first workable version after test and bug fixes