still struggling with R estimation
Code cleanup