Fixed indentation of code I added in previous commit; Added a null check and removed a .trim()