Use before_action and improve some methods