Debug & refatoring