beaglebone: code refactoring part 4