it looks like you are repeating the same code here, might want to try and abstract this into a helper