Improvements on robot code