Add dirty code to make it work. Need to improve performance.