naive approach implemented. still little errors. some corrected.