Moved some panel code to seperate file