Missing semicolons. Missing semicolons everywhere!
Split up device's  function