remove redundant code, add error dialog (instead of alerts), change styling slightly