naive approach implemented. still little errors.