beaglebone: code refactoring part 2