Replace scanner's nextLine() call with next()
Move logic to startup and service

Signed-off-by: Kirill Zotkin <kirillzotkin@gmail.com>