merging dobri + my code and making it slower