Improved tests. Code isolated