Added dependency and removed duplicate button code