finished first version with several changes