Clean up loginview code