Implemented if-conditions completely and added several tests.