Fixed reference to glass pane and moved prepare to common layer