dirty code with some of local and some of google implemented