Database function now works now reformating the views