added working login page, some common function