Added functional Panel and some logic for rotation