Improved properties panel code