improve ui and main logic