Allow better detection of mobile devices. Also added tests.