Fixed dp issues and done actual device detection. Math might be wrong though; needs testing