refactoring and introduced new abstractions to allow mulltiple devices support