Initial pass at device abstraction

This should go before #118 
same as above.